/**
  * Author: Mei
  * Date: 2020-12-10 20:44
  * Description: 递归
  *
  */
#include "../head.h"

using namespace std;

template<typename ... Values>
class tuple1; //先定义  后面才能使用偏特例化

int k = 8;

template<>
class tuple1<> {
public:
    tuple1() {
        cout << "show time, k = " << k-- << endl;
    }
};

template<typename Head, typename ...Tail>
class tuple1<Head, Tail...> {
    typedef tuple1<Tail...> composited;
protected:
    composited m_tail; //采用复合的方式  不使用继承
    Head m_head;
public:
    tuple1() {
    }

    tuple1(Head v, Tail ...vtail) : m_tail(vtail...), m_head(v) {
    }

    Head head() {
        return m_head;
    }

    composited &tail() {
        return m_tail;
    }
};

int main() {
    tuple1<string, int, float, string> t("nico", 12, 4.3, "nico");
    cout << t.head() << endl;
    cout << t.tail().head() << endl;



    return 0;
}

